

function validateForm() {
    var x = document.forms["myForm"]["fname"].value;
    if (x == null || x == "") {
        alert("需要输入名字。");
        return false;
    }
}

function validateForm(){
	var x=document.forms["myForm"]["email"].value;
	var atpos=x.indexOf("@");
	var dotpos=x.lastIndexOf(".");
	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length){
		alert("不是一个有效的 e-mail 地址");
  		return false;
	}
}

function verification(){
    var x = document.forms["form01"][name01].value
    var index_1 = indexof('@');
    var index_2 = lastindexof(".")
    if(x == '' || x == null || index_1 < 1 || (index_2-index_1) != 2 ){
        alert("输入错误！");
        return false;
    }

}


function verfivation02(){
    var x = document.getElementById("id1");
    if (x.checkValidity() == false) {
        document.getElementById("demo").innerHTML = inpObj.validationMessage;
    } else {
        document.getElementById("demo").innerHTML = "输入正确";
    }
}
